package com.yuelao.exception;

import lombok.Data;

/**
 * @author FLY
 * @version v1.0
 * @project yuelao-server
 * @date 2017/9/11 18:13
 * @修改记录 版本       修改人         修改时间         修改内容描述
 * --------------------------------------------------
 * <p>
 * --------------------------------------------------
 */
@Data
public class BaseResponse {
    private final static Integer SUC_CODE = 0;
    private final static String SUC_MSG = "success";
    private final static String ERR_MSG = "error";
    private Integer code = 0;
    private String response = SUC_MSG;
    private String msg = "";
    private Object obj;

    public BaseResponse success(final String sucMsg) {
        this.msg = sucMsg;
        return this;
    }

    public BaseResponse fail(final Integer errorCode, final String errMsg) {
        this.msg = errMsg;
        this.code = errorCode;
        this.response = ERR_MSG;
        return this;
    }

    public BaseResponse setObj(Object obj) {
        this.obj = obj;
        return this;
    }

}
